micropump 2.2.1
Loading...
Searching...
No Matches
micropump


Micro Pump Click

Micro Pump Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Jan 2025.
  • Type : ADC type

Software Support

Example Description

This example demonstrates the use of the Micro Pump Click board. It initializes the Click module, calibrates the offset for accurate current measurements, and then controls the motor in different states while measuring and logging the output current in milliamps (mA).

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.MicroPump

Example Key Functions

Application Init

Initializes the logger and the Micro Pump Click driver and performs offset calibration.

void application_init ( void )
{
log_cfg_t log_cfg;
micropump_cfg_t micropump_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
micropump_cfg_setup( &micropump_cfg );
if ( ADC_ERROR == micropump_init( &micropump, &micropump_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( MICROPUMP_ERROR == micropump_calib_offset ( &micropump ) )
{
log_error( &logger, " Offset calibration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define MICROPUMP_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition micropump.h:112
void application_init(void)
Definition main.c:34
#define MIKROBUS_POSITION_MICROPUMP
Definition main.c:28
@ MICROPUMP_ERROR
Definition micropump.h:157

Application Task

Alternates the motor's operational states between COAST and FORWARD. For each state, it logs the motor's current consumption.

void application_task ( void )
{
float current = 0;
log_printf( &logger, " Motor state : COAST\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
if ( MICROPUMP_OK == micropump_get_out_current ( &micropump, &current ) )
{
log_printf( &logger, " Current : %.3f mA\r\n\n", current );
}
log_printf( &logger, " Motor state : FORWARD\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
if ( MICROPUMP_OK == micropump_get_out_current ( &micropump, &current ) )
{
log_printf( &logger, " Current : %.3f mA\r\n\n", current );
}
}
#define MICROPUMP_MOTOR_COAST
Micro Pump motor control setting.
Definition micropump.h:91
#define MICROPUMP_MOTOR_FORWARD
Definition micropump.h:92
void application_task(void)
Definition main.c:70
@ MICROPUMP_OK
Definition micropump.h:156

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.